package org.germinus.telcoblocks.infraestructuras.diagram.part;

import java.util.ArrayList;
import java.util.List;

import org.eclipse.gef.Tool;
import org.eclipse.gef.palette.PaletteContainer;
import org.eclipse.gef.palette.PaletteDrawer;
import org.eclipse.gef.palette.PaletteRoot;
import org.eclipse.gef.palette.ToolEntry;
import org.eclipse.gmf.runtime.diagram.ui.tools.UnspecifiedTypeConnectionTool;
import org.eclipse.gmf.runtime.diagram.ui.tools.UnspecifiedTypeCreationTool;
import org.germinus.telcoblocks.infraestructuras.diagram.providers.TelcoblocksElementTypes;

/**
 * @generated
 */
public class TelcoblocksPaletteFactory {

	/**
	 * @generated
	 */
	public void fillPalette(PaletteRoot paletteRoot) {
		paletteRoot.add(createBloques1Group());
		paletteRoot.add(createHerramientas2Group());
	}

	/**
	 * Creates "Bloques" palette tool group
	 * @generated
	 */
	private PaletteContainer createBloques1Group() {
		PaletteDrawer paletteContainer = new PaletteDrawer(
				Messages.Bloques1Group_title);
		paletteContainer.add(createServidor_VOIP1CreationTool());
		paletteContainer.add(createCentralita_VOIP2CreationTool());
		paletteContainer.add(createMediaServer3CreationTool());
		paletteContainer.add(createServidor_APP_SIP4CreationTool());
		paletteContainer.add(createTelefono_VOIP5CreationTool());
		paletteContainer.add(createSoftPhone_VOIP6CreationTool());
		return paletteContainer;
	}

	/**
	 * Creates "Herramientas" palette tool group
	 * @generated
	 */
	private PaletteContainer createHerramientas2Group() {
		PaletteDrawer paletteContainer = new PaletteDrawer(
				Messages.Herramientas2Group_title);
		paletteContainer.add(createEnlace1CreationTool());
		return paletteContainer;
	}

	/**
	 * @generated
	 */
	private ToolEntry createServidor_VOIP1CreationTool() {
		List/*<IElementType>*/types = new ArrayList/*<IElementType>*/(1);
		types.add(TelcoblocksElementTypes.Servidor_VOIP_2008);
		NodeToolEntry entry = new NodeToolEntry(
				Messages.Servidor_VOIP1CreationTool_title,
				Messages.Servidor_VOIP1CreationTool_desc, types);
		entry
				.setSmallIcon(TelcoblocksInfraestructurasDiagramEditorPlugin
						.findImageDescriptor("/telcoblocks/imagenes/toolbox/Servidor_VoIP.png")); //$NON-NLS-1$
		entry
				.setLargeIcon(TelcoblocksInfraestructurasDiagramEditorPlugin
						.findImageDescriptor("/telcoblocks/telcoblocks/imagenes/toolbox/Servidor_VoIP.png")); //$NON-NLS-1$
		return entry;
	}

	/**
	 * @generated
	 */
	private ToolEntry createCentralita_VOIP2CreationTool() {
		List/*<IElementType>*/types = new ArrayList/*<IElementType>*/(1);
		types.add(TelcoblocksElementTypes.Centralita_VOIP_2011);
		NodeToolEntry entry = new NodeToolEntry(
				Messages.Centralita_VOIP2CreationTool_title,
				Messages.Centralita_VOIP2CreationTool_desc, types);
		entry
				.setSmallIcon(TelcoblocksInfraestructurasDiagramEditorPlugin
						.findImageDescriptor("/telcoblocks/imagenes/toolbox/Centralita_VoIP.png")); //$NON-NLS-1$
		entry
				.setLargeIcon(TelcoblocksInfraestructurasDiagramEditorPlugin
						.findImageDescriptor("/telcoblocks/imagenes/toolbox/Centralita_VoIP.png")); //$NON-NLS-1$
		return entry;
	}

	/**
	 * @generated
	 */
	private ToolEntry createMediaServer3CreationTool() {
		List/*<IElementType>*/types = new ArrayList/*<IElementType>*/(1);
		types.add(TelcoblocksElementTypes.MediaServer_2009);
		NodeToolEntry entry = new NodeToolEntry(
				Messages.MediaServer3CreationTool_title,
				Messages.MediaServer3CreationTool_desc, types);
		entry
				.setSmallIcon(TelcoblocksInfraestructurasDiagramEditorPlugin
						.findImageDescriptor("/telcoblocks/imagenes/toolbox/Media_Server_VoIP.png")); //$NON-NLS-1$
		entry
				.setLargeIcon(TelcoblocksInfraestructurasDiagramEditorPlugin
						.findImageDescriptor("/telcoblocks/imagenes/toolbox/Media_Server_VoIP.png")); //$NON-NLS-1$
		return entry;
	}

	/**
	 * @generated
	 */
	private ToolEntry createServidor_APP_SIP4CreationTool() {
		List/*<IElementType>*/types = new ArrayList/*<IElementType>*/(1);
		types.add(TelcoblocksElementTypes.Servidor_APP_SIP_2010);
		NodeToolEntry entry = new NodeToolEntry(
				Messages.Servidor_APP_SIP4CreationTool_title,
				Messages.Servidor_APP_SIP4CreationTool_desc, types);
		entry
				.setSmallIcon(TelcoblocksInfraestructurasDiagramEditorPlugin
						.findImageDescriptor("/telcoblocks/imagenes/toolbox/Servidor_App.png")); //$NON-NLS-1$
		entry
				.setLargeIcon(TelcoblocksInfraestructurasDiagramEditorPlugin
						.findImageDescriptor("/telcoblocks/imagenes/toolbox/Servidor_App.png")); //$NON-NLS-1$
		return entry;
	}

	/**
	 * @generated
	 */
	private ToolEntry createTelefono_VOIP5CreationTool() {
		List/*<IElementType>*/types = new ArrayList/*<IElementType>*/(1);
		types.add(TelcoblocksElementTypes.Telefono_VOIP_2012);
		NodeToolEntry entry = new NodeToolEntry(
				Messages.Telefono_VOIP5CreationTool_title,
				Messages.Telefono_VOIP5CreationTool_desc, types);
		entry
				.setSmallIcon(TelcoblocksInfraestructurasDiagramEditorPlugin
						.findImageDescriptor("/telcoblocks/imagenes/toolbox/Telefono_VoIP.png")); //$NON-NLS-1$
		entry
				.setLargeIcon(TelcoblocksInfraestructurasDiagramEditorPlugin
						.findImageDescriptor("/telcoblocks/imagenes/toolbox/Telefono_VoIP.png")); //$NON-NLS-1$
		return entry;
	}

	/**
	 * @generated
	 */
	private ToolEntry createSoftPhone_VOIP6CreationTool() {
		List/*<IElementType>*/types = new ArrayList/*<IElementType>*/(1);
		types.add(TelcoblocksElementTypes.SoftPhone_VOIP_2007);
		NodeToolEntry entry = new NodeToolEntry(
				Messages.SoftPhone_VOIP6CreationTool_title,
				Messages.SoftPhone_VOIP6CreationTool_desc, types);
		entry
				.setSmallIcon(TelcoblocksInfraestructurasDiagramEditorPlugin
						.findImageDescriptor("/telcoblocks/imagenes/toolbox/SoftPhone_VoIP.png")); //$NON-NLS-1$
		entry
				.setLargeIcon(TelcoblocksInfraestructurasDiagramEditorPlugin
						.findImageDescriptor("/telcoblocks/imagenes/toolbox/SoftPhone_VoIP.png")); //$NON-NLS-1$
		return entry;
	}

	/**
	 * @generated
	 */
	private ToolEntry createEnlace1CreationTool() {
		List/*<IElementType>*/types = new ArrayList/*<IElementType>*/(1);
		types.add(TelcoblocksElementTypes.Enlace_4001);
		LinkToolEntry entry = new LinkToolEntry(
				Messages.Enlace1CreationTool_title,
				Messages.Enlace1CreationTool_desc, types);
		entry
				.setSmallIcon(TelcoblocksInfraestructurasDiagramEditorPlugin
						.findImageDescriptor("/telcoblocks/imagenes/toolbox/Enlace.gif")); //$NON-NLS-1$
		entry
				.setLargeIcon(TelcoblocksInfraestructurasDiagramEditorPlugin
						.findImageDescriptor("/telcoblocks/imagenes/toolbox/Enlace.gif")); //$NON-NLS-1$
		return entry;
	}

	/**
	 * @generated
	 */
	private static class NodeToolEntry extends ToolEntry {

		/**
		 * @generated
		 */
		private final List elementTypes;

		/**
		 * @generated
		 */
		private NodeToolEntry(String title, String description,
				List elementTypes) {
			super(title, description, null, null);
			this.elementTypes = elementTypes;
		}

		/**
		 * @generated
		 */
		public Tool createTool() {
			Tool tool = new UnspecifiedTypeCreationTool(elementTypes);
			tool.setProperties(getToolProperties());
			return tool;
		}
	}

	/**
	 * @generated
	 */
	private static class LinkToolEntry extends ToolEntry {

		/**
		 * @generated
		 */
		private final List relationshipTypes;

		/**
		 * @generated
		 */
		private LinkToolEntry(String title, String description,
				List relationshipTypes) {
			super(title, description, null, null);
			this.relationshipTypes = relationshipTypes;
		}

		/**
		 * @generated
		 */
		public Tool createTool() {
			Tool tool = new UnspecifiedTypeConnectionTool(relationshipTypes);
			tool.setProperties(getToolProperties());
			return tool;
		}
	}
}
